<%
Function SiteUrl()
	If Application("SiteUrl") = "" Then
		SERVER_NAME = Request.ServerVariables("SERVER_NAME")
		SERVER_PORT = Request.ServerVariables("SERVER_PORT")
		PATH_INFO = Request.ServerVariables("PATH_INFO")
		Url = SERVER_NAME
		If SERVER_PORT = 80 Then
		Else
			Url = Url & ":80"
		End If
		Url = Url & PATH_INFO
		
		Tmp = Split(Url,"/")
		Url = ""
		For i=0 To Ubound(Tmp)-Len(Replace(dbdns,"/",""))
			Url = Url & Tmp(i) & "/"
		Next
		Url = "http://" & Url
		Application("SiteUrl") = Url
	Else
		Url = Application("SiteUrl")
	End If
	SiteUrl = Url
End Function

Private Sub ToHtml(FromURL,FilePath)
	FilePath = Server.MapPath(FilePath)
	Set objXmlHttp=Server.createObject("Microsoft." & "XMLHTTP")
	objXmlHttp.open "GET",FromURL,false
	objXmlHttp.send()
	binFileData=objXmlHttp.responseBody
	Set objXmlHttp = Nothing
	Set objAdoStream=Server.createObject("ADODB." & "Stream")
	objAdoStream.Type=1
	objAdoStream.Open()
	objAdoStream.Write(binFileData)
	objAdoStream.SaveToFile FilePath,2
	objAdoStream.Close()
	Set objAdoStream = Nothing
End Sub

Private Sub Index_Html()
	FromURL = SiteUrl() & "index.asp?html=" & Now()
	FilePath = dbdns & "index.html"
	Call ToHtml(FromURL,FilePath)
End Sub


Private Sub Article_Page_Html(ID)
	Sql="select ID from Article where ID=" & ID
	Set oRs = Conn_i.Execute(Sql)
	ID = oRs(0)
	oRs.Close
	Set oRs = Nothing
	
			FilePath = dbdns & HTML_Article_Path & ID & ".html"
			FromURL = SiteUrl() & "show.asp?id=" & ID & "&page=" & oI & "&html=" & Now()
		Call ToHtml(FromURL,FilePath)
End Sub

Private Sub Article_List_Html(PageNo,ClassID)
	FromURL = SiteUrl() & "list.asp?id=" & ClassID & "&PageNo=" & PageNo & "&html=" & Now()
	FilePath = dbdns & HTML_Article_Path & "list_" & ClassID
	If PageNo<>1 Then FilePath = FilePath & "_" & PageNo
	FilePath = FilePath & ".html"
	Call ToHtml(FromURL,FilePath)
End Sub
%>